<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>输出结果如下</p>
    <button onclick="Hello()">你好</button>
    <p id="demo"></p>

    <script>
        function Hello() {
            let x = "", i; 
            for (i = 0; i < 5; i++) {
                x = x + "这个数字是" + i + "<br>";
            }
            document.getElementById("demo").innerHTML = x;
        }
    </script>
</body>

</html>